#-*- codeing = utf-8 -*-
#@Time:2022/9/1517:00
#@Author :计科1813-14-张玉婷
#@File:4.6.py
#@Software:PyCharm
import random
fall = open("总名单.txt", "r", encoding="UTF-8")
all = fall.read()
namelist = all.split('\n')
s = len(namelist)   # 名单长度
sed = 0   # 点过人数
remain = 0    # 剩余人数
print("-----计科1813、1814总人数:%d-----" % s)
x = '1'
while x == '1':
    temp = random.choice(namelist)
    namelist.remove(temp)   #点过名的不会再被点到
    print("随机点名中:%s" % (temp))    # 输出点到名的同学的名字
    sed += 1
    remain = s - sed
    print("已随机带匿名的人数：%d,未点到的人数：%d" % (sed, remain))

    f=open("新名单.txt", "w", encoding="UTF-8")    #存储新的文件 for line in nanelist:
    for line in namelist:
        f.write(line+'\n')
    f.close()

    if not namelist:
        print("点名结束")
        break
    else:
        print("-"*31)
        x = input("是否继续点名[1继续/0结束]")
        while x != '1' and x != '0':
            x = input("请输入正确选项[0/1]")